import requestMeeting, { request } from '@/plugins/axios'
import { FetchMeetingSpaceShareInfo, FetchMeetingDocParams } from './interface'
/** 获取address */
export const fetchGetCodeAddress = async () =>
	requestMeeting<string>({
		url: '/core_address',
		method: 'get',
	}).then((res) => (res.success ? res.data : undefined))

/** 获取会议文档列表 */
export const fetchGetMeetingFiles = async (meetingMoid: string) =>
	request<FetchMeetingDocParams>({
		url: `/meeting_files/${meetingMoid}`,
		method: 'get',
	}).then((res) => (res.success ? res.meeting_files : undefined))

/** 删除会议文档 */
export const fetchDeleteMeetingFiles = async (id: string) =>
	requestMeeting({
		url: `/meeting_files/${id}`,
		method: 'Delete',
	}).then((res) => res)

/** 获取会议文档分享信息 */
export const fetchGetMeetingSpaceShareInfo = async (meetingMoid: string) =>
	requestMeeting<FetchMeetingSpaceShareInfo>({
		url: `/meetings/${meetingMoid}/meeting_files/share`,
		method: 'get',
	}).then((res) => res)
